Skip to content

Conversation

rachelks
Copy link
Member

What changed

  • Treats first_publish_year: 0 from the Open Library API as missing data
  • Adds a test to make sure an invalid publication year is normalized to null

This prevents books with missing publication data from displaying First published: 0.

Manual testing

Tested with The Invisible Man by H. G. Wells, which previously displayed:

First published: 0

After the fix, the invalid publication year is no longer shown. The book is also placed last when sorting by both newest and oldest, as missing publication years are intended to be.

Valid publication years are still displayed normally.

Verification

  • Tests pass - 71/71
  • ESLint passes
  • Prettier check passes
  • Production build passes
  • Manually verified in the browser

Closes #47

@rachelks rachelks requested a review from a team as a code owner September 18, 2026 12:18
@rachelks rachelks linked an issue Sep 18, 2026 that may be closed by this pull request
@rachelks rachelks added ai-assisted Substantial AI-generated code (documented per spec) type: bug Something is not working as intended area: api OpenLibrary REST API and TanStack Query labels Sep 18, 2026
@rachelks rachelks added this to the M5 — Delivery milestone Sep 18, 2026
@rachelks rachelks changed the title fix: handle invalid publication year (#47) fix: handle invalid publication year Sep 18, 2026
Copy link
Member

@robertky robertky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Invalid publication years are now handled as missing data, the regression test covers the fix

@robertky robertky merged commit 2a70cc7 into main Sep 18, 2026
1 check passed
Sign in to join this conversation on GitHub.
Labels
ai-assisted Substantial AI-generated code (documented per spec) area: api OpenLibrary REST API and TanStack Query type: bug Something is not working as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix: Handle invalid publication year from Open Library
2 participants